package com.xj.edu.hotel.service.serviceImpl;

import com.xj.edu.hotel.domain.Room;
import com.xj.edu.hotel.domain.RoomExample;
import com.xj.edu.hotel.mapper.RoomMapper;
import com.xj.edu.hotel.service.RoomService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class RoomServiceImpl implements RoomService {

    @Autowired
    private RoomMapper roomMapper;

    @Override
    public Room findRoomByHotelIdAndRoomId(String hotelId, Integer roomId) {
        return roomMapper.selectByHotelIdAndRoomId(hotelId, roomId);
    }

    @Override
    public int updateRoomStatus(Room room) {
        return roomMapper.updateByExampleSelective(room, new RoomExample());
    }

    @Override
    public Room findRoomByRoomId(String id) {
        return roomMapper.selectByPrimaryKey(id);
    }

    @Override
    public int updateRoomPic(Room room) {
        return roomMapper.updateByPrimaryKeySelective(room);
    }

    @Override
    public List<Room> searchRoom(String hotelId) {
        return roomMapper.searchRoom(hotelId);
    }

    @Override
    public Room findRoomByid(String roomId){return roomMapper.findRoomByid(roomId);}

    @Override
    public List<Room> roomView(String hotelName){return roomMapper.roomView(hotelName);}

    @Override
    public List<Room> hotelComment(String hotelId){return roomMapper.hotelComment(hotelId);}

    @Override
    public int updateRoomCount(Room room) {
        return roomMapper.updateByPrimaryKeySelective(room);
    }





}
